package heip.generator.entity;
import java.util.ArrayList;
import java.util.List;
/**
 * 主要是用于界面设置值，
 * 和传递模板变量用处，目前只是用于实体生成这边用到
 * 
 * Title: 
 * Description: 
 * Copyright (c) 2011 ICSS HaiSheng Co.,Ltd 
 * All rights reserved
 * @author wanghm 
 * Create Date:2013-8-5 下午2:18:43
 * Modify By:
 * Modify Date:
 * Remark:
 *
 */
public class EntityTable {
		private String tableName;
		private String fkColumn;
		
		private String idGenerType;//"uuid","sequence"
		private String sequenceName;
		
		private List<EntityTable> subEntitys=new ArrayList<EntityTable>();
		//private String cnName;
		
		/**
		 * 
		 * @param tableName 单表
		 */
		public EntityTable(String tableName){
			this.tableName = tableName;
		}
		
		/**
		 * 新建主表对象
		 * @param tableName
		 * @param subEntitys 单表不设置
		 */
		public EntityTable(String tableName,EntityTable... subEntitys){
			this.tableName = tableName;
			if(subEntitys!=null&&subEntitys.length>0){
				for(EntityTable en:subEntitys){
					this.subEntitys.add(en);
				}
			}
		}
		
		
		/**
		 * 新建子表对象
		 * @param tableName 
		 * @param fkColumn 外键 关联父表的字段
		 * @param subEntitys 子表list，如果没有NULL
		 */
		public EntityTable(String tableName,String fkColumn,EntityTable... subEntitys){
			this.tableName = tableName;
			this.fkColumn = fkColumn;
			if(subEntitys!=null&&subEntitys.length>0){
				for(EntityTable en:subEntitys){
					this.subEntitys.add(en);
				}
			}
		}
		
		
		public boolean hasSubTable(){return subEntitys!=null&&!subEntitys.isEmpty();}
		
		
		//----------------getter and setter---------------//
		
		public List<EntityTable> getSubEntitys() {return subEntitys;}
		
		public String getTableName() {return tableName;}
		public String getFkColumn() {return fkColumn;}
		public String getIdGenerType() {
			return idGenerType;
		}

		public void setIdGenerType(String idGenerType) {
			this.idGenerType = idGenerType;
		}

		public String getSequenceName() {
			return sequenceName;
		}

		public void setSequenceName(String sequenceName) {
			this.sequenceName = sequenceName;
		}
		
}